<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="TOKN">﻿</span><span class="COMM">/*
<span class='line'>  2</span> Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
<span class='line'>  3</span> For licensing, see LICENSE.html or http://ckeditor.com/license
<span class='line'>  4</span> */</span><span class="WHIT">
<span class='line'>  5</span>
<span class='line'>  6</span> </span><span class="COMM">/**
<span class='line'>  7</span>  * @fileOverview Defines the {@link CKEDITOR.dom.event} class, which
<span class='line'>  8</span>  *		represents the a native DOM event object.
<span class='line'>  9</span>  */</span><span class="WHIT">
<span class='line'> 10</span>
<span class='line'> 11</span> </span><span class="COMM">/**
<span class='line'> 12</span>  * Represents a native DOM event object.
<span class='line'> 13</span>  * @constructor
<span class='line'> 14</span>  * @param {Object} domEvent A native DOM event object.
<span class='line'> 15</span>  * @example
<span class='line'> 16</span>  */</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="NAME">CKEDITOR.dom.event</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">domEvent</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 18</span> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 19</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 20</span> 	 * The native DOM event object represented by this class instance.
<span class='line'> 21</span> 	 * @type Object
<span class='line'> 22</span> 	 * @example
<span class='line'> 23</span> 	 */</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="WHIT">	</span><span class="NAME">this.$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">domEvent</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 26</span>
<span class='line'> 27</span> </span><span class="NAME">CKEDITOR.dom.event.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 30</span> 	 * Gets the key code associated to the event.
<span class='line'> 31</span> 	 * @returns {Number} The key code.
<span class='line'> 32</span> 	 * @example
<span class='line'> 33</span> 	 * alert( event.getKey() );  "65" is "a" has been pressed
<span class='line'> 34</span> 	 */</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">	</span><span class="NAME">getKey</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">	</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.$.keyCode</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.$.which</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 39</span>
<span class='line'> 40</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 41</span> 	 * Gets a number represeting the combination of the keys pressed during the
<span class='line'> 42</span> 	 * event. It is the sum with the current key code and the {@link CKEDITOR.CTRL},
<span class='line'> 43</span> 	 * {@link CKEDITOR.SHIFT} and {@link CKEDITOR.ALT} constants.
<span class='line'> 44</span> 	 * @returns {Number} The number representing the keys combination.
<span class='line'> 45</span> 	 * @example
<span class='line'> 46</span> 	 * alert( event.getKeystroke() == 65 );                                   // "a" key
<span class='line'> 47</span> 	 * alert( event.getKeystroke() == CKEDITOR.CTRL + 65 );                   // CTRL + "a" key
<span class='line'> 48</span> 	 * alert( event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65 );  // CTRL + SHIFT + "a" key
<span class='line'> 49</span> 	 */</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">	</span><span class="NAME">getKeystroke</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">	</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keystroke</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getKey</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span>
<span class='line'> 54</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this.$.ctrlKey</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.$.metaKey</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">			</span><span class="NAME">keystroke</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CKEDITOR.CTRL</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 56</span>
<span class='line'> 57</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this.$.shiftKey</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">			</span><span class="NAME">keystroke</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CKEDITOR.SHIFT</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 59</span>
<span class='line'> 60</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this.$.altKey</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">			</span><span class="NAME">keystroke</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">CKEDITOR.ALT</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 62</span>
<span class='line'> 63</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">keystroke</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 65</span>
<span class='line'> 66</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 67</span> 	 * Prevents the original behavior of the event to happen. It can optionally
<span class='line'> 68</span> 	 * stop propagating the event in the event chain.
<span class='line'> 69</span> 	 * @param {Boolean} [stopPropagation] Stop propagating this event in the
<span class='line'> 70</span> 	 *		event chain.
<span class='line'> 71</span> 	 * @example
<span class='line'> 72</span> 	 * var element = CKEDITOR.document.getById( 'myElement' );
<span class='line'> 73</span> 	 * element.on( 'click', function( ev )
<span class='line'> 74</span> 	 *     {
<span class='line'> 75</span> 	 *         // The DOM event object is passed by the "data" property.
<span class='line'> 76</span> 	 *         var domEvent = ev.data;
<span class='line'> 77</span> 	 *         // Prevent the click to chave any effect in the element.
<span class='line'> 78</span> 	 *         domEvent.preventDefault();
<span class='line'> 79</span> 	 *     });
<span class='line'> 80</span> 	 */</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">	</span><span class="NAME">preventDefault</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">stopPropagation</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">	</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.$</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">$.preventDefault</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">			</span><span class="NAME">$.preventDefault</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">		</span><span class="KEYW">else</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">			</span><span class="NAME">$.returnValue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 88</span>
<span class='line'> 89</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">stopPropagation</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">		</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">$.stopPropagation</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">				</span><span class="NAME">$.stopPropagation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">			</span><span class="KEYW">else</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">				</span><span class="NAME">$.cancelBubble</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'> 98</span> 	 * Returns the DOM node where the event was targeted to.
<span class='line'> 99</span> 	 * @returns {CKEDITOR.dom.node} The target DOM node.
<span class='line'>100</span> 	 * @example
<span class='line'>101</span> 	 * var element = CKEDITOR.document.getById( 'myElement' );
<span class='line'>102</span> 	 * element.on( 'click', function( ev )
<span class='line'>103</span> 	 *     {
<span class='line'>104</span> 	 *         // The DOM event object is passed by the "data" property.
<span class='line'>105</span> 	 *         var domEvent = ev.data;
<span class='line'>106</span> 	 *         // Add a CSS class to the event target.
<span class='line'>107</span> 	 *         domEvent.getTarget().addClass( 'clicked' );
<span class='line'>108</span> 	 *     });
<span class='line'>109</span> 	 */</span><span class="WHIT">
<span class='line'>110</span>
<span class='line'>111</span> </span><span class="WHIT">	</span><span class="NAME">getTarget</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">	</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">rawNode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.$.target</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">this.$.srcElement</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">rawNode</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">CKEDITOR.dom.node</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">rawNode</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>116</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>117</span>
<span class='line'>118</span> </span><span class="COMM">/**
<span class='line'>119</span>  * CTRL key (1000).
<span class='line'>120</span>  * @constant
<span class='line'>121</span>  * @example
<span class='line'>122</span>  */</span><span class="WHIT">
<span class='line'>123</span> </span><span class="NAME">CKEDITOR.CTRL</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1000</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>124</span>
<span class='line'>125</span> </span><span class="COMM">/**
<span class='line'>126</span>  * SHIFT key (2000).
<span class='line'>127</span>  * @constant
<span class='line'>128</span>  * @example
<span class='line'>129</span>  */</span><span class="WHIT">
<span class='line'>130</span> </span><span class="NAME">CKEDITOR.SHIFT</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">2000</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>131</span>
<span class='line'>132</span> </span><span class="COMM">/**
<span class='line'>133</span>  * ALT key (4000).
<span class='line'>134</span>  * @constant
<span class='line'>135</span>  * @example
<span class='line'>136</span>  */</span><span class="WHIT">
<span class='line'>137</span> </span><span class="NAME">CKEDITOR.ALT</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">4000</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>138</span> </span></pre></body></html>
